package com.meta.pic.io

import androidx.annotation.WorkerThread
import com.meta.pic.Result
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Query

class HomeRepository(retrofit: Retrofit) {
    private val service by  lazy {
        retrofit.create(HomeService::class.java)
    }

    @WorkerThread
    fun getPics(l:String, page: Int, size: Int) = service.getPics(l, page, size).execute()

}

interface HomeService {

    @GET("j")
    fun getPics(
        @Query("q") q: String,
        @Query("sn") page: Int,
        @Query("pn") size: Int
    ): Call<Result>
}